from django.urls import path

from users import views

urlpatterns = (
    # 登录的路由
    path('login/', views.LoginView.as_view()),
    # 注册的路由
    path('register/', views.RegisterView.as_view()),
    # 获取单个用户信息
    path('users/<int:pk>/', views.UserView.as_view({'get': 'retrieve'})),
    # 上传用户头像
    path('<int:pk>/avatar/upload', views.UserView.as_view({"post": "upload_avatar"})),
    # 发送验证码
    path('sendsms/', views.SMSView.as_view()),
    # 绑定手机
    path('<int:pk>/mobile/bind/', views.UserView.as_view({
        "put": "bind_mobile"
    })),
    # 解绑手机
    path('<int:pk>/mobile/unbind/', views.UserView.as_view({
        "put": "unbind_mobile"
    })),
    # 更新昵称
    path('<int:pk>/name/', views.UserView.as_view({
        "put": "update_name"
    })),
    # 修改密码
    path('<int:pk>/password/', views.UserView.as_view({
        "put": "update_password"
    })),
    # 绑定用户邮箱
    path('<int:pk>/email/bind/', views.UserView.as_view({
        "put": "bind_email"
    })),
)